package com.guigu.lc.controller.sys;

import com.guigu.common.pojo.SysMenus;
import com.guigu.common.pojo.SysUsers;
import com.guigu.lc.serach.MenusSerach;
import com.guigu.lc.service.sys_MenusService;
import com.guigu.lc.view.Menuanduserview;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 动态菜单
 */
@Controller
@RequestMapping("/sys")
@ResponseBody()
public class MenusController {

    @Resource
    private sys_MenusService sysservice;


    //动态菜单
    @RequestMapping("/load_menus_id")
    public  Map<String, Map<String,List<SysMenus>>> load_menus_id(){
        Subject subject = SecurityUtils.getSubject();
        SysUsers user1 = (SysUsers) subject.getSession().getAttribute("user");
        return this.sysservice.querymapmenusService(user1.getLoginId());
    }

//    所有菜单
    @RequestMapping("/queryallmenuByuserid")
    public MenusSerach queryallmenuByuserid(MenusSerach menusSerach){
        return this.sysservice.queryAllMenusService(menusSerach);
    }
}
